package com.xidian.zhiancloud.controller.luling.RiskIdentificationPart;
import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.service.luling.RiskIdentificationPart.RiskAssessmentStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
/**
 * 风险评价接口
 * @Author:luling
 * @Date:2021/1/7   15:24
 **/
@RestController
@RequestMapping("/RiskAssessmentStatus")
public class RiskAssessmentStatusController {
    @Autowired
    private RiskAssessmentStatusService riskAssessmentStatusService;
    /**
     * 根据id添加风险评价信息
     *
     * @param ids ids数组
     * @return  返回ResultDTO对象
     **/
    @PostMapping("/insertByIds")
    public ResultDTO<Boolean> insertByIds(Long[] ids) {
        riskAssessmentStatusService.equals(ids);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    /**
     * 根据type查询风险评价信息
     *
     * @param type 辨识评价类型
     * @return 返回ResultDTO对象
     **/
    @GetMapping("/getById/{type}")
    public ResultDTO<Object> getById(
            @PathVariable String type) {
        return ResultDTO.successOf(riskAssessmentStatusService.getById(type), GeneralResponseEnums.SUCCESS);
    }
    /**
     * 列表查询
     *
     * @param  riskName 辨识评价计划名称
     * @param deadlineIden 辨识截止时间
     * @param  type  辨识评价类型
     * @param   key    关键字
     * @param current   分页偏移量
     * @param size    每一页的数量
     * @return 返回风险评价列表
     **/
    @GetMapping("/getList")
    public ResultDTO<Object> getList(@RequestParam(value = "riskName", required = false) String riskName,
                             @RequestParam(value = "deadlineIden", required = false) Date deadlineIden,
                             @RequestParam(value = "type", required = false) String type,
                             @RequestParam(value = "key", required = false) String key,
                             @RequestParam(value = "current", required = true) int current,
                             @RequestParam(value = "size", required = true) int size) {
        return ResultDTO.successOf(riskAssessmentStatusService.getList(riskName, deadlineIden,type,key,current, size), GeneralResponseEnums.SUCCESS);
    }

}
